package org.study.searchsummer;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.annotation.AnnotationBeanNameGenerator;

/**
 * 
* @Description: 针对mybatis多数据源时,把对应springbean的名称重新命名
* @author: 席登强   
* @date: 2018年1月28日 上午11:02:02 
*
 */
public class HystreamSpringNameGenerator extends AnnotationBeanNameGenerator {
	private static final Logger LOG = LoggerFactory.getLogger(HystreamSpringNameGenerator.class);
	@Override
	public String generateBeanName(BeanDefinition definition, BeanDefinitionRegistry registry) {
		String name = super.generateBeanName(definition, registry);
		if(name.startsWith("mmber")){
			return name;
		}
		name = name + "_mmber";
		LOG.info("重新命名:" + name);
		return name;
	}

}
